/**
 * 
 */
package info.niwota.install;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

/**
 * @author qiangli
 * 
 */
public class Installer {

	/**
	 * 
	 */
	private Installer() {
	}

	public static void install(Context ctx, String path) {
		Intent intent = new Intent(ctx, InstallActivity.class);
		intent.putExtra(InstallActivity.EXTRA_PATH, path);
		intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		ctx.startActivity(intent);
	}

	public static void uninstall(Context ctx, String pkg) {
		Uri uri = Uri.parse("package:" + pkg);
		Intent intent = new Intent(Intent.ACTION_DELETE, uri);
		intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		ctx.startActivity(intent);
	}
}
